package 力扣._1465切割后面积最大的蛋糕;

import java.util.Arrays;

public class Solution {
    public int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {
        //排序
        Arrays.sort(horizontalCuts);
        Arrays.sort(verticalCuts);
        //找到最大宽、高
        int max_h = 0, max_w = 0;
        int t = 0;
        for (int n : horizontalCuts) {
            max_h = Math.max(max_h, n - t);
            t = n;
        }
        max_h = Math.max(max_h, h - t);
        t = 0;
        for (int n : verticalCuts) {
            max_w = Math.max(max_w, n - t);
            t = n;
        }
        max_w = Math.max(max_w, w - t);
        long r = ((long) max_h * max_w) % 1000000007;
        return (int) r;

    }

    public static void main(String[] args) {
        int i = new Solution().maxArea(5, 4, new int[]{3, 1}, new int[]{1});
        System.out.println(i);
    }
}
